package Stringbuffer和stringbuilder;

public class Test {
    public static void main(String[] args) {
        StringBuffer hello = new StringBuffer("hello");
        hello.append("  java");
        hello.append(" python").append("  fjg");
        System.out.println(hello);
        hello.delete(hello.indexOf("h"),hello.indexOf("o")+1);
        System.out.println(hello);
        hello.deleteCharAt(hello.indexOf(""));
        System.out.println(hello);
        hello.insert(hello.indexOf(""),"python");
        System.out.println(hello);
        hello.replace(hello.indexOf("p"),hello.indexOf("n")+1,"c++");
        System.out.println(hello);
        hello.setCharAt(1,' ');
        hello.setCharAt(2,' ');
        System.out.println(hello);
        hello.trimToSize();
        String s = hello.toString();
        System.out.println(s);
        System.out.println(hello.reverse());

    }
}
